
import javax.crypto.KeyGenerator;
import java.security.NoSuchAlgorithmException;

/**
 * @author weiZhiLin
 * @version 1.0
 * @date 2019/12/26 13:53
 */
public class SimplePhoneFactoryTest {
    public static void main(String[] args) throws NoSuchAlgorithmException {
        SimplePhoneFactory factory = new SimplePhoneFactory();
        System.out.println(factory.cratePhone("6").getName());
        System.out.println(factory.cratePhone("7").getName());
        System.out.println(factory.cratePhone("123").getName());
        // 该方法也使用工厂模式
        // KeyGenerator keyGen=KeyGenerator.getInstance("DESede");

        // 测试反射工厂
        iPhone6 ip6 = (iPhone6) ReflectFactory.getClass(iPhone6.class);
        iPhone7 ip7 = (iPhone7) ReflectFactory.getClass(iPhone7.class);
        iPhone8 ip8 = (iPhone8) ReflectFactory.getClass(iPhone8.class);
        System.out.println(ip6.getName());
        System.out.println(ip7.getName());
        System.out.println(ip8.getName());

    }
}
